package com.scoring.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.scoring.system.mapper.AchievementMapper;
import com.scoring.system.pojo.Achievement;
import com.scoring.system.service.AchievementService;
@Service("achievementService")
public class AchievementServiceImpl implements AchievementService {
	
	@Resource
	private AchievementMapper achievementDao;

	@Override
	public int softDelete(int id) {
		return achievementDao.softDelete(id);
	}

	@Override
	public int saveAchievement(Achievement record) {
		return achievementDao.insert(record);
	}

	@Override
	public Achievement getAchievementById(int id) {
		return achievementDao.selectByPrimaryKey(id);
	}

	@Override
	public List<Achievement> listAchievementByStudentIdAndTerm(int studentId, String term) {
		return achievementDao.listAchievementByStudentIdAndTerm(studentId, term);
	}

	@Override
	public List<Achievement> listAchievementByClassIdAndTerm(int classId, String term) {
		return achievementDao.listAchievementByClassIdAndTerm(classId, term);
	}

	@Override
	public List<Achievement> listAchievementByClassIdAndTermAndCourseId(int classId, String term, int courseId) {
		return achievementDao.listAchievementByClassIdAndTermAndCourseId(classId, term, courseId);
	}

	@Override
	public int updateAchievement(Achievement record) {
		return achievementDao.updateByPrimaryKey(record);
	}

	@Override
	public List<Achievement> listAchievementByClassId(int classId) {
		return achievementDao.listAchievementByClassId(classId);
	}

	@Override
	public List<Achievement> listAchievementByStudentId(int studentId) {
		return achievementDao.listAchievementByStudentId(studentId);
	}

	@Override
	public Achievement getAchievementByStudentIdAndCourseId(int studentId, int courseId) {
		return achievementDao.selectByStudentAndCourse(studentId, courseId);
	}


}
